<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src='./template-web.js'></script>
</head>
<body>
  <ul> </ul>
  <script type="text/html" id="tpl">
    {{each arr1}}
      <li>这是第1个li====id:{{$value.id}}===name:{{$value.name}}</li>
    {{/each}}
  </script>

  <script type="text/html" id="tpl2">
    <% for(var i=0; i< arr1.length; i++) {%>
      <li>这是第1个li====id:<%=arr1[i].id%>===name:<%=arr1[i].name%></li>
    <%}%>
  </script>

  <script>
    var  arr=[
      {id:1,name:'jack'},
      {id:2,name:'rose'},
      {id:3,name:'tom'},
    ]

    //var  html=template('tpl',{arr1:arr})
    var  html=template('tpl2',{arr1:arr})
    console.log(html,99);
    document.querySelector('ul').innerHTML=html


  </script>
</body>
</html>